import ApiUrl from "./ApiUrl";
import ajaxUtis from "@/utils/AjaxUtis";
var UserService = {
  getUserPage:function (params,success,error) {
    ajaxUtis.get(ApiUrl.USER_PAGE_URL,params).then((response)=>{
      if (response && response.hasOwnProperty("result")){
        success(response.result);
      }
    }).catch((err)=>{
      error(err);
    })
  },

  add:function (params,success,error){
    ajaxUtis.post(ApiUrl.USER_ADD_URL,params).then((response)=>{
      if (response && response.hasOwnProperty("result")){
        success(response.result);
      }
    }).catch((err)=>{
      error(err);
    })
  },

  update:function (params,success,error) {
    ajaxUtis.put(ApiUrl.USER_UPDATE_URL,params).then((response)=>{
      if (response && response.hasOwnProperty("result")){
        success(response.result);
      }
    }).catch((err)=>{
      error(err);
    })
  },

  deleteById:function (id,success,error) {
    ajaxUtis.del(ApiUrl.USER_DELETE_BYID_URL+"/"+id).then((response)=>{
      if (response && response.hasOwnProperty("result")){
        success(response.result);
      }
    }).catch((err)=>{
      error(err);
    })
  }
};
export default UserService
